<?php
/*****************************
* PHPwork官方网址： ruanjiesoft.com
* PHPwork应用官方QQ群： 317075601
* PHPwork应用开发者QQ： 1980572700
* 不得使用本软件用于非法用途，不得违反国家法律。
*************************************/

namespace application\cms\controller;

require 'base.php';

class Index extends Base{

   
    function index(){   
        
        //轮播图
        $sql="select * from ".tablename('rj_cms_slider')." where status=1 and `type`='轮播' order by list_order";
        $slider=$GLOBALS['db']->query($sql);
        
        //文章分类
        $sql="select * from ".tablename('rj_cms_article_sort')." where status=1 and place='2屏通栏' order by list_order";
        $article=$GLOBALS['db']->query($sql)->fetchall();
        foreach($article as $k => $row){
            //文章
            $sql="select * from ".tablename('rj_cms_article')." where status=1 and sort_id={$row['sort_id']} order by flag desc,update_time desc limit 0,8";
            $article[$k]['article']=$GLOBALS['db']->query($sql)->fetchall();
        }

        //商品
        $sql="select * from ".tablename('rj_cms_goods')." where status=1 and flag like '%推荐%' order by update_time desc";
        $goods=$GLOBALS['db']->query($sql);

        //链接
        $sql="select * from ".tablename('rj_cms_friendlink')." where status=1 order by list_order";
        $friendlink=$GLOBALS['db']->query($sql);


        require view('default/index.tpl.php');
    } 



}